Content addressable memory (CAM) device and method for updating data by multiplexing between key register and mask value input

ABSTRACT

A content addressable memory (CAM) can include a CAM memory array having both a data field and a mask field. A multiplexer (MUX) can selectively load data from either a register or an external data input to one or both fields of the CAM memory array.

This application claims the benefit of U.S. provisional patent application Ser. No. 60/531,830, filed Dec. 23, 2003.

TECHNICAL FIELD

The present invention relates generally to content addressable memory (CAM) devices, and more particularly to approaches to updating data in CAM devices.

BACKGROUND OF THE INVENTION

Content addressable memory (CAM) devices enjoy a variety of applications due to their fast matching capability. As an example, Network Search Engines (NSEs) often use CAM devices to provide fast searches of a database, list, and/or pattern, such as in computers and communication networks. A CAM can simultaneously compare a specific pattern of bits, commonly known as a search key or comparand, against a large number of bit patterns stored in an associated CAM memory array. In this way, an entire CAM array can be searched in parallel.

A CAM array may optionally have a mask value for each entry that indicates which bit location(s) in an entry to match, and hence which bits to exclude from a compare/search operation. If there is a match for every non-masked bit in a location (e.g., entry) with every corresponding bit of a comparand, a match flag can be asserted to let the user know that the comparand data was found in the CAM. In addition, a value corresponding to the matching location can be returned. Thus, in a CAM device a result can be determined from finding a matching value (content), not from providing the address for value, as is done for a Random Access Memory (RAM).

In some devices or systems, if no matching entries are found, a learn instruction can subsequently be executed. A learn instruction can instruct a CAM device to write comparand data used in a search, that resulted in a miss, into a next available empty location in the CAM array.

A conventional circuit and process of implementing a learn function or operation is shown in FIGS. 5A to 5C. A conventional circuit 500 can include a data field 502-0 and mask field 502-1. In addition, a conventional CAM circuit can include an internal comparand register 504 as a source of data for a learn operation. Data field 502-0 can include an available entry (represented by Data=???), while mask field 502-1 can include a mask for the available entry (represented by Mask=???).

Referring now to FIG. 5A, prior to a search operation, an internal comparand register 504 can be empty or store data from a previous operation that is not used (represented by Reg=???).

As shown in FIG. 5B, after a search operation has been executed and completed, comparand data from the search (Data1) can be stored in internal comparand register 504 (represented by Reg=Data1).

FIG. 5C shows the execution of a subsequent learn operation. Such an operation can occur whether or not the previous search operation resulted in no matching entries. When a learn operation is executed, comparand data (Data1) previously stored in internal comparand register 504 can be used as write data to be loaded data in to the internal CAM memory array.

A problem with the above conventional approach can be that when the learn instruction is executed, only the contents of internal register 504 are used for the write data. As shown in FIG. 5C, a learn instruction can result in a write to either a data field 502-0 or mask field 502-1 in the CAM memory array. Unfortunately, since there is only one internal register with a value inside, the same value gets written into either the mask or data field or to both. This can represent a limitation or failure of the conventional learn operation, as this is generally not what a user wants or intends.

In a learn operation, the user usually wants to store a <mask, data> pair into a free entry of a CAM memory array where the mask and data values could be different. Since a search operation only uses the data portion as the search key, the internal comparand register 504 will contain only the data portion, and the mask field cannot be updated with a unique or different value.

There have been several attempts to overcome or work around the above problem. Generally, such conventional approaches involve convoluted and costly solutions that are not wholly satisfactory. For example, a conventional approach can execute a learn operation to write data into a data field, as desired. Then, a number of extra read operations are performed to try and determine the address of the entry to which the data has been written. Once the address has been located, a unique mask value can be written into the corresponding location within the mask field.

Accordingly, it would be desirable to arrive at some way of updating both the mask field and the data field using a learn operation.

SUMMARY OF THE INVENTION

The present invention can provide solutions to these and other problems, and offers further advantages over conventional content addressable memories (CAMs) and methods of operating the same.

In one aspect, the present invention is directed to a CAM having a memory array with a first field for storing data, a second field for storing mask data, and a register for storing data. The CAM can further include a selection means adapted to load first data from either the register or an external data input to one or both of the first and second fields of the memory array.

Such an arrangement can enable the rapid loading of a mask from an external source in response to a learn operation. This can remove a constraint present in conventional approaches.

Preferably, a selection means can include a multiplexer (MUX) adapted to load first data from the register to one of the first and second fields of the CAM memory array, and to load second data from the external data input to the other field of the CAM memory array. More preferably, the first data can be loaded into the register as a result of a search operation executed in response to a search instruction. A MUX can select first or second data for loading into the first or second field of the memory array based on a control bit contained in a learn instruction.

Such an arrangement allows for simple writing of desired mask data with a small variation in an existing learn instruction.

Optionally, the CAM can include more than two external data inputs and/or more than one register, and the MUX can be adapted to load data from any one of the external data inputs or more than one register to one or both of the first and second fields of the memory array.

According to one aspect of the embodiments, a selecting step can include loading mask data into the second field and then loading data into the first field.

According to another aspect of the embodiments, a method can further include initially executing a search operation and loading a search key of the first operation into the register as first data.

According to another aspect of the embodiments, a method can include executing a learn operation in response to a learn instruction. A selecting step includes selecting first data and external data according to at least one bit of the learn instruction. In this way, a data path provided by a MUX can be selected with a learn instruction.

The present invention can also include a CAM device with a CAM array having a data field with a plurality of entries and a mask field that stores mask values corresponding to the entries. In addition, a MUX can have a first input coupled to receive an externally applied data value, a second input coupled to at least one register, and an output coupled to the data field and mask field. In this way, a CAM device can rapidly select from between a stored data value or an externally applied data value to provide an output value to a data field and/or mask field.

According to one aspect of the embodiments, a MUX can have a control input coupled to receive learn instruction data. In this way, a MUX operation can be controlled according to a learn instruction and/or associated data.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A to 1C are block schematic diagrams showing a content addressable memory (CAM) and method according to embodiments of the present invention.

FIG. 2 is a table showing instructions according to one embodiment of the present invention.

FIGS. 3A to 3D are block schematic diagrams showing alternate embodiments of the present invention.

FIG. 4 is a flowchart showing a method according to an embodiment of the present invention.

FIGS. 5A to 5C are block schematic diagrams showing a conventional CAM operation.

DETAILED DESCRIPTION

The present invention is directed to a novel content addressable memory (CAM), and to circuits and methods for enabling the selection of a source for learn data, where such learn data can be loaded into multiple fields of a CAM array.

A CAM according to a first embodiment is shown in FIGS. 1A to 1C and designated by the general reference character 100. A CAM 100 can include a CAM memory array 102, a register 104, an external data input 106, and a multiplexer (MUX) 108.

A CAM memory array 102 can include a data field 102-0 and a mask field 102-1. According to well understood techniques, data values can be stored in data entries of data field 102-0. Each such data entry can have a corresponding mask entry in mask field 102-1. In a search operation, or the like, a search key value can be compared to data entries according to the corresponding mask value.

A register 104 can store data values for use in various operations in a CAM 100, including but not limited to, search operations and learn operations. As but one very particular example, following a search operation a register 104 can store the search key value used to search the data entries. In a learn operation, a register 104 can continue to store such search key data, and such search key data can be loaded (e.g., written) into a selected available data entry.

An external data input 106 can receive data from outside a CAM 100. As but one example, such data may be received on an external data bus. In one even more particular example, an external data input 106 can receive mask data that accompanies a learn instruction.

A MUX 108 can be connected between register 104, external data input 106 and CAM memory array 102. Even more particularly, a MUX 108 can have one input connected to register 104, another input connected to external data input 106, and an output connected to CAM memory array 102. As is well understood, a MUX 108 can selectively provide data paths between in its inputs and outputs according to control data CTRL.

One particular operation of the CAM 100 will now be described with reference to FIGS. 1A to 1C. In the operation shown, a search operation is executed. Following the search operation, a learn operation is executed that stores a data value and mask value in a CAM memory array 102.

Referring to FIG. 1A, prior to a search operation, within CAM 100, a register 104 may not store a value, or may store a value that is no longer needed. This is represented by the notation “Reg.=???”. In addition, a CAM memory array 102 can include an available entry. This is represented by the notation “Mask=???” and “Data=???”.

Referring to FIG. 1B, following a search operation, but prior to a learn operation, a data value (Data1) can be stored in register 104. The data value (Data1) can be a search key, for example, utilized in the search operation. That is, a data value (Data1) can be supplied by or loaded in response to a previous search operation or instruction. This is represented by the notation “Reg.=Data1”.

Referring to FIG. 1C, in a learn operation, a data value (Data1) can be provided to a CAM memory array 102 from register 104 by operation of MUX 108. In addition, and unlike conventional approaches, an externally received data value (Data2) can also be provided to CAM memory array 102 from external data input 106. In one particular example, an externally received data value (Data2) can be mask value that corresponds to data value (Data1).

FIG. 1C also shows how a MUX 108 can be controlled according to values generated in response to a learn command (e.g., learn opcode). As but one example, a new control bit can be added to a Learn Instruction and set by a user. When a Learn Instruction is executed, the new control bit can control a MUX (e.g., 108) in the data path. According to such control, a MUX 108 can select between data in register 104 (supplied by or loaded in response to a previous search operation or instruction) and data on an external data input 106.

For example, in the embodiment shown in FIG. 1C, first data (Data1) loaded in register 104 (e.g., by a previous search instruction) can be loaded into the data field 102-0 in CAM memory array 102. Second data (Data2) can be loaded from external data input 106 the mask field 102-1 of CAM memory array 102.

It is understood that a MUX 108 can be subject to variation in form. For example, a MUX may provide sequential data paths to multiple fields (e.g., 102-0 and 102-1) or provide such paths in parallel, provided data are available at inputs of MUX 108.

One very particular approach to a learn instruction arrangement is shown in FIG. 2. FIG. 2 is a table showing a correspondence between instructions and resulting codes. The table shows well understood instructions: Read, Write and Search. However, the table also shows two variations of a Learn instruction. The two Learn instructions demonstrate how a least significant bit (LSB) can specify from which location data is loaded into a particular CAM memory array field. In the example shown, when an LSB of a Learn instruction is “0”, data from a register can be loaded into a CAM memory array. Conversely, when an LSB of a learn instruction is “1”, data from an data bus can be loaded into a CAM memory array.

It is understood that the above example represents but one possible arrangement. The operation of a MUX can be controlled by data provided generally “in conjunction” with a learn instruction. Thus, data establishing a particular MUX operation could be alternatively be stored in a register, and/or provided as a programmable mode of operation for a CAM.

Along these same lines, a Learn instruction could result in the automatic sequential loading of data from a register and external source. For example, the same learn instruction could result in data from a register (e.g., 104) being written into a data field 102-0, followed by the automatic writing of data from an external data input (e.g., 106) into a mask field 102-1.

Of course, while the above embodiments have shown particular arrangements, it will be appreciated that various alternative embodiments of the CAM are possible. A few examples of possible alternative embodiments are shown in FIGS. 3A to 3D. The alternate embodiments include some of the same general components as FIGS. 1A to 1C. Accordingly, like components will be referred to by the same reference character but with the first digit being a “3” instead of a “1”, and a description thereof will be omitted.

FIG. 3A shows how a MUX 308 can select between two internal registers. Thus, the CAM of FIG. 3A can include a first internal register 304 and a second internal register 310 connected to inputs of MUX 308.

FIG. 3B shows how a MUX 308 can select between two external data inputs. Thus, the CAM of FIG. 3B can include a first internal external data input 306 and a second external data input 312 connected to inputs of MUX 308.

Of course, according to other embodiments, a MUX can select from between a combination of any number of inputs and/or registers.

Still further, while the above embodiments have shown arrangements in which data can be written to a mask field and a data field, it will be appreciated that a MUX can be operated to write to the mask field only or to the data field only.

FIG. 3C shows how a CAM can include a MUX 314 that can write to only a data field 302-0. FIG. 3D shows how a CAM can include a MUX 314′ that can write to only a mask field 302-1.

According to another embodiment, a method or process can include automatically updating both a mask field and data field of a CAM according to a learn instruction. Such a method is set forth in FIG. 4 in a flowchart, and designated by the general reference character 400.

A method 400 can include issuing a search instruction using a data value as a search key 402. Such an operation can include a user issuing a search instruction in conjunction with appropriate search key data.

In one particular approach, if a search operation is successful (e.g., a search key matches an entry value), no learn operation can be performed. If, however, a search operation fails (e.g., a search key does not match any entries), a learn operation can be performed.

In either case (search success or failure), the search key can be loaded into the internal register (404).

The particular diagram of FIG. 4 assumes that a search fails. Consequently, a learn operation can be executed. More particularly, a learn operation can write to a data field of a next available free entry in a CAM memory array. The data for the write operation can be data stored in an internal register (406).

In one very particular arrangement, a step 406 can be executed in response to a first issued learn instruction.

Unlike a conventional approach, a method 400 can further include issuing a second learn instruction having a control bit that directs a MUX to select an external bus as a source of load data. Data can then be written to the mask field of the available free entry using data supplied by the external bus (408).

It will be appreciated that the order in which data is written to a mask field and a data field should not be considered limiting to the present invention.

An advantage of the CAM and method according to the various embodiments can be the efficient and automatic update of both the mask and the data fields of a free entry in the CAM memory array using the same instruction.

It is also understood that the embodiments of the invention may be practiced in the absence of an element and/or step not specifically disclosed. That is, an inventive feature of the invention can be elimination of an element.

The foregoing description of specific embodiments and examples of the invention have been presented for the purpose of illustration and description, and although the invention has been described and illustrated by certain of the preceding examples, it is not to be construed as being limited thereby. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and many modifications, improvements and variations within the scope of the invention are possible in light of the above teaching. It is intended that the scope of the invention encompass the generic area as herein disclosed, and by the claims appended hereto and their equivalents. 

1. A content addressable memory (CAM), comprising: a CAM memory array having a first field for storing data and a second field for storing mask data; a register for storing data from an external data input; and a multiplexer (MUX) coupled to the register, to the first and second fields of the CAM memory array, and to the external data input, the MUX selectively providing data from either the register or the external data input to one or both of the first and second fields of the CAM memory array.
 2. The CAM of claim 1, wherein: the MUX comprises a 2×2 MUX adapted to load first data from the register to one or both of the first and second fields of the CAM memory array, and to load second data from the external data input to one or both of the first and second fields of the CAM memory array.
 3. The CAM of claim 1, wherein: the register is coupled to store search key data from a search operation.
 4. The CAM of claim 1, wherein: the MUX includes a control input coupled to receive learn instruction data.
 5. The CAM of claim 4, wherein: the learn instruction data comprises a bit in a learn instruction applied to the CAM.
 6. The CAM of claim 1, wherein: the MUX is adapted to load first data from the register to one of the first and second fields of the CAM memory array and load second data into the other of the first and second fields of the CAM memory array.
 7. The CAM of claim 1, further including: N external data inputs, where N is a whole number greater than 2; and the MUX is adapted to load second data from one of the N external data inputs to one or both of the first and second fields of the CAM memory array.
 8. The CAM of claim 1, further including: M registers, where M is a whole number greater than 1; and the MUX is adapted to load first data from one of the M registers to one or both of the first and second fields of the CAM memory array.
 9. A method for storing data in a content addressable memory (CAM), comprising: storing first data from a first external data input in a register of the CAM; receiving second data from an external data input; and selecting with a multiplexer (MUX) first data to be loaded from either the register or the external data input to one or both of first and second fields of a memory array.
 10. The method of claim 9, wherein: the selecting step comprises the MUX providing first data from the register to either first or second fields of the memory array, and the MUX providing second data to either first or second fields of the memory array.
 11. The method of claim 9, wherein: the selecting step comprises loading mask data into the second field and then loading data into the first field.
 12. The method of claim 9, further including: initially executing a search operation; and loading a search key of the search operation into the register as the first data.
 13. The method of claim 9, further including: executing a learn operation in response to a learn instruction; and the selecting step includes selecting first data and external data according to at least one bit of the learn instruction.
 14. A content addressable memory (CAM) device, comprising: a CAM array having a data field with a plurality of entries and a mask field that stores mask values corresponding to the entries; and a multiplexer (MUX) having a first input coupled to receive an externally applied data value, a second input coupled to at least one register, and an output coupled to the CAM array, the at least one register coupled to receive a search key value from a search operation.
 15. The CAM device of claim 14, wherein: the MUX has a control input coupled to receive learn instruction data.
 16. The CAM device of claim 15, wherein: the MUX has a control input coupled to a signal corresponding to a bit value of the learn instruction.
 17. The CAM device of claim 14, wherein: the MUX couples a search key value from a previous search operation to the data field, and a mask value on an external input to the mask field in response to a learn operation command.
 18. The CAM device of claim 14, wherein: the MUX has the second input coupled to receive the externally applied data value from one of a plurality of data inputs.
 19. The CAM device of claim 14, wherein: the MUX has the first input coupled to a plurality of registers. 